#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string mergeAlternately(string word1, string word2) {
        int n1 = word1.size(), n2 = word2.size();
        string str;
        int i = 0;
        for (; i < min(n1, n2); i++)
        {
            str += word1[i];
            str += word2[i];
        }

        if (n1 < n2)
            while (i < n2) str += word2[i++];
        else if (n1 > n2)
            while (i < n1) str += word1[i++];
        return str;

    }
};